package com.example.shouybl.ui;


import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;

import com.example.shouybl.R;

public class SplashActivity extends BaseActivity {

    private android.widget.ImageView ivloading;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        initView();

    }

    private void initView() {
        this.ivloading = (ImageView) findViewById(R.id.iv_loading);
        RotateAnimation animation=new RotateAnimation(0,360, Animation.RELATIVE_TO_PARENT, 1.0f, Animation.RELATIVE_TO_SELF, 1.0f);
        AnimationSet set=new AnimationSet(false);
        set.addAnimation(animation);
        set.setDuration(3 * 1000);
        ivloading.startAnimation(animation);
       /* AnimationDrawable drawable= (AnimationDrawable) ivloading.getBackground();
        drawable.start();*/
        animation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                Intent intent=new Intent(SplashActivity.this,MainActivity.class);
                startActivity(intent);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });
    }


}
